<?php
/**
 * Text element
 *
 */
class ArrowFormMail extends ArrowFormField{
	
	
	public function configure(){
		parent::configure();	
		$this->addProperties(array(
			"length" => "1,"
		));
	}	
	
	public function validate( $proposedValue ){
		return (boolean) preg_match( '/^.+?@.+?..+$/', $proposedValue);
	}
	
	public function generateOutput(){
		$attribuites = array();
		$attribuites["name"] = $this->getHtmlName();
		$attribuites["value"] = $this->getValue();
		$hint = $this->getHint();
		if($hint)
			$attribuites["hint"] = $hint;
		return '<input type="text" '.$this->genTagsFromArray($attribuites).' '.$this->addExternal().'/>';
	}


}
?>